<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Bootstrap Material Admin</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/4.2.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.default.css" id="theme-stylesheet">
  </head>
 
  <body>
	  <script>
  function intestlogin(){
	  
	  //var un=document.getElementById("username")
	 var uinyzm=document.getElementById("yzmcode1").value;
	 var sinyzm=document.getElementById("login-pic").innerHTML;
	 var UN=document.getElementById("username1");
	 var PW=document.getElementById("password1");
     var YZM=document.getElementById("yzmcode1");  
	  if(UN.value!= "" && PW.value!=""&&YZM.value!=""){
	  if(uinyzm==sinyzm){
		   document.getElementById('login1').type='submit';//当账号密码不为空时可发送信息到后台进行验证
	   }else{
	   document.getElementById('imsg').style.display='block';   
	   }
	 }
	 }

 
  </script>
    <div class="page login-page">
      <div class="container d-flex align-items-center">
        <div class="form-holder has-shadow">
          <div class="row">
            <!-- Logo & Information Panel-->
            <div class="col-lg-6">
              <div class="info d-flex align-items-center">
                <div class="content">
                  <div class="logo">
                    <h1>欢迎登录</h1>
                  </div>
                  <p>光宗耀组远程管理系统</p>
                </div>
              </div>
            </div>
            <!-- Form Panel    -->
            <div class="col-lg-6 bg-white">
              <div class="form d-flex align-items-center">
                <div class="content">
                  <form method="post" action="JSLoginServlet" class="form-validate" id="loginFrom">
                    <div class="form-group">
                      <input id="username1" type="text" name="username" required data-msg="请输入用户名" placeholder="用户名" value="admin" class="input-material">
                    </div>
                    <div class="form-group">
                      <input id="password1" type="password" name="password" required data-msg="请输入密码" placeholder="密码" class="input-material">
                    </div>
					<p>
					<div class="form-yzm">
					  <input id="yzmcode1" type="text" name="yzmcode" required data-msg="请输入验证码" placeholder="验证码" class="input-material">
					</div>
					<div class="yzmpic" id="login-pic"  >
					</div>
					<div class="yzmcontent"><a href="#"  onclick="show()">看不清，换一张</a></div>
					<div id="imsg" style="display: none;" >验证码错误！</div>
					</p>
                    <button id="login1" type="button" class="btn btn-primary" onclick="intestlogin()">登录</button>
                    <div style="margin-top: -40px;"> 
                    	<!-- <input type="checkbox"  id="check1"/>&nbsp;<span>记住密码</span>
                    	<input type="checkbox" id="check2"/>&nbsp;<span>自动登录</span> --> 
                    	<div class="custom-control custom-checkbox " style="float: right;">
											    <input type="checkbox" class="custom-control-input" id="check2" >
											    <label class="custom-control-label" for="check2">自动登录</label>
											</div>
											<div class="custom-control custom-checkbox " style="float: right;">
											    <input type="checkbox" class="custom-control-input" id="check1" >
											    <label class="custom-control-label" for="check1">记住密码&nbsp;&nbsp;</label>
											</div> 
                    </div>
                  </form>
           <div class="jump">
                  <small>没有账号?</small><a href="register.html" class="signup">&nbsp;注册</a></div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- JavaScript files-->
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js"></script>
	<script src="getCode.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="vendor/jquery-validation/jquery.validate.min.js"></script><!--表单验证-->
    <!-- Main File-->
    <script src="js/front.js"></script>
    <script>
    	/*$(function(){
    		/*判断上次是否勾选记住密码和自动登录*/
    		//var check1s=localStorage.getItem("check1");
    		//var check2s=localStorage.getItem("check2");
    		//var oldName=localStorage.getItem("userName");
    		//var oldPass=localStorage.getItem("passWord");
    		//if(check1s=="true"){
    		//	 $("#login-username").val(oldName);
    		//	 $("#login-password").val(oldPass);
    	/*		 $("#check1").prop('checked',true);
    		}else{
    			 $("#login-username").val('');
    			 $("#login-password").val('');
    			 $("#check1").prop('checked',false);
    		}
    		if(check2s=="true"){
    			$("#check2").prop('checked',true);
    			$("#loginFrom").submit();
    			//location="https://www.baidu.com?userName="+oldName+"&passWord="+oldPass;//添加退出当前账号功能
    		}else{
    			$("#check2").prop('checked',false);
    		}
    		/*拿到刚刚注册的账号*/
    		/*if(localStorage.getItem("name")!=null){
    			$("#login-username").val(localStorage.getItem("name"));
    		}*/
    		/*登录*/
    	/*	$("#login").click(function(){
    			var userName=$("#login-username").val();
    			var passWord=$("#login-password").val();
    			/*获取当前输入的账号密码*/
    		//	localStorage.setItem("userName",userName)
    		//	localStorage.setItem("passWord",passWord)
    			/*获取记住密码  自动登录的 checkbox的值*/
    		/*	var check1 = $("#check1").prop('checked');
	    		var check2 = $('#check2').prop('checked');
	    		localStorage.setItem("check1",check1);
	    		localStorage.setItem("check2",check2);
    		})*/
    		
    		/*$("#check2").click(function(){
    			var flag=$('#check2').prop('checked');
    			if(flag){
    				var userName=$("#login-username").val();
	    			var passWord=$("#login-password").val();
	    			$.ajax({
	    				type:"post",
	    				url:"http://localhost:8080/powers/pow/regUsers",
	    				data:{"userName":userName,"passWord":passWord},
	    				async:true,
	    				success:function(res){
	    					alert(res);
	    				}
	    			});
    			}
    		})
    	})*/
		
			/*function login(){
			/*
			if(username.value == "" && password.value==""&&login-yzmcode.value==""){
				msg.style.display="block";
				msg.innerText="账号和密码不能为空";
				return;
			}if(username.value == ""){//注意感叹号不能是中文字符
				msg.innerText="账号不能为空";
				msg.style.display="block";
				//遇到错误要终止
				return;
			}if(password.value == ""){
				msg.style.display="block";
				msg.innerText="密码不能为空";
				return;
			}if(login-yzmcode.value==""){
				msg.style.display="block";
				msg.innerText="验证码不能为空";
			}*/
				
				//document.getElementById('msg').style.display="block";
				
				/*var uinyzm=document.getElementById("login-yzmcode").innerHTML;
				var sinyzm=document.getElementById("login-pic").innerHTML;			
			
            if(username.value != "" && password.value!=""&&login-yzmcode.value!=""){
				if(uinyzm==sinyzm){
				document.getElementById('login').type='submit';//当账号密码不为空时可发送信息到后台进行验证
				//遇到错误要终止
				return;
			}
			}else{
				msg.style.display="block";
				msg.innerText="验证码错误！";
			}*/
		//}
		
    </script>
  </body>
</html>